/*
 * $Id: PropertiesReloadTask.java,v 1.2 2009/07/10 16:27:06 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.util;

import java.util.Date;
import java.util.TimerTask;

import com.ge.healthcare.autosc.common.ASCLogger;
import com.ge.healthcare.autosc.common.database.dao.IRunDetailsDAO;
import com.ge.healthcare.autosc.common.dbLogger.StepLogger;

/**
 * @author 212042764
 * 
 */
public class PropertiesReloadTask extends TimerTask {
	private String processName = null;
	private IRunDetailsDAO runDetailsDAO = null;

	/**
	 * Spring Likes me
	 */
	public PropertiesReloadTask() {
		super();
	}

	/**
	 * @see java.util.TimerTask#run()
	 */
	public void run() {
		String methodName = "run";
		ASCLogger.info(this.getClass(), methodName, "Invoked at : "
				+ new Date());
		try {
			ApplicationInfo.getInstance().loadProperties();
			runDetailsDAO.saveRunDetails(processName
					+ StepLogger.getStepTypeId());
		} catch (RuntimeException runtimeException) {
			ASCLogger.error(this.getClass(), methodName,
					"Thread execution stopped by runtime exception:",
					runtimeException);
		}
	}

	/**
	 * @param processName
	 *            the processName to set
	 */
	public void setProcessName(String processName) {
		this.processName = processName;
	}

	/**
	 * @param runDetailsDAO
	 *            the runDetailsDAO to set
	 */
	public void setRunDetailsDAO(IRunDetailsDAO runDetailsDAO) {
		this.runDetailsDAO = runDetailsDAO;
	}
}
